<template>
  <ComponentContainerProperty v-model="formData.style">
    <el-form label-width="80px" :model="formData">
      <el-card header="卡片样式" class="property-group" shadow="never">
        <el-form-item label="卡片长度" prop="cardWidth">
          <el-input
            v-model="formData.cardWidth"
            placeholder="请输入卡片横向长度"
            type="number"
            controls-position="right"
          />
          <el-text type="info">单位：px</el-text>
        </el-form-item>
        <el-form-item label="卡片圆角" prop="borderRadiusCard">
          <el-slider
            v-model="formData.borderRadiusCard"
            :max="100"
            :min="0"
            show-input
            input-size="small"
            :show-input-controls="false"
          />
        </el-form-item>
        <el-form-item label="标题大小" prop="nameSize">
          <el-input
            v-model="formData.nameSize"
            placeholder="请输入标题文字大小"
            type="number"
            controls-position="right"
          />
          <el-text type="info">单位：px</el-text>
        </el-form-item>
        <el-form-item label="标题粗细" prop="titleWeight">
          <el-slider
            v-model="formData.titleWeight"
            :max="900"
            :min="100"
            :step="100"
            input-size="small"
            show-input
          />
        </el-form-item>
        <el-form-item label="简介大小" prop="introSize">
          <el-input
            v-model="formData.introSize"
            placeholder="请输入简介文字大小"
            type="number"
            controls-position="right"
          />
          <el-text type="info">单位：px</el-text>
        </el-form-item>
        <el-form-item label="封面高度" prop="bannerHeight">
          <el-input
            v-model="formData.bannerHeight"
            placeholder="请输入轮播图高度"
            type="number"
            controls-position="right"
          />
          <el-text type="info">单位：px</el-text>
        </el-form-item>

        <el-form-item label="间隔" prop="space">
          <el-slider
            v-model="formData.space"
            :max="100"
            :min="0"
            show-input
            input-size="small"
            :show-input-controls="false"
          />
        </el-form-item>
      </el-card>
      <el-card header="卡片内容" class="property-group" shadow="never">
        <Draggable v-model="formData.list" :empty-item="EMPTY_MENU_GRID_ITEM_PROPERTY">
          <template #default="{ element }">
            <el-form-item label="封面图" prop="bannerUrl">
              <UploadImg v-model="element.bannerUrl" height="150px" width="200px">
<!--                <template #tip> 建议尺寸：44 * 44 </template>-->
              </UploadImg>
            </el-form-item>
            <el-form-item label="标题" prop="title">
              <InputWithColor v-model="element.title" v-model:color="element.titleColor" />
            </el-form-item>
            <el-form-item label="副标题" prop="subtitle">
              <InputWithColor v-model="element.subtitle" v-model:color="element.subtitleColor" />
            </el-form-item>
            <el-form-item label="链接" prop="url">
              <AppLinkInput v-model="element.url" />
            </el-form-item>
            <el-form-item label="卡片背景" prop="bgColor">
              <ColorInput v-model="element.bgColor" />
            </el-form-item>
          </template>
        </Draggable>
      </el-card>
    </el-form>
  </ComponentContainerProperty>
</template>

<script setup lang="ts">
import { ProductListProperty } from './config'
import { useVModel } from '@vueuse/core'
import SpuShowcase from '@/views/mall/product/spu/components/SpuShowcase.vue'
import {
  EMPTY_MENU_GRID_ITEM_PROPERTY
} from "@/components/DiyEditor/components/mobile/MenuGrid/config";

// 商品栏属性面板
defineOptions({ name: 'ProductListProperty' })

const props = defineProps<{ modelValue: ProductListProperty }>()
const emit = defineEmits(['update:modelValue'])
const formData = useVModel(props, 'modelValue', emit)
</script>

<style scoped lang="scss"></style>
